#req=urllib.request.urlopen(url="http://localhost/temp/post.php?id=123")
#print(req.read().decode('utf-8'))
import urllib.request
import random
ids=['ff80808151c4ea280151cccfbc415088',
    'ff80808151c4ea280151cccfa5735077',
    'ff80808151c4ea280151cccf6c9a5051',
    'ff80808151c4ea280151cccf84985062',
    'ff80808151c4ea280151cccf7f955058']
for id in ids:
    ti=str(random.randint(1500, 1800))
    url='http://hdpx.webtrn.cn/learning/entity/first/peTchCoursewareItem_saveStudyTime.action?course_id='+id+'&msg='+ti
    cookies='JSESSIONID=10303B0842C33EBB7D91B464BFAED93B.web129_tyxl_learning; _uid=f16b0bb5-46f9-43f7-a813-89edf8ed37ef; _whatycms=jYZZs6Mtbu; _webtrn=tD9DVhtfVd; UC00OOIIll11="eW54eTE1MDYxMjY6LTE6NmU1MmY1ZjFiODZmMGY1Zjc0ZTRmNzA4NTk2YTcwMWI6bnVsbDpoZHB4LndlYnRybi5jbg=="; JSESSIONID=59BCF21AA4802BCA858338F7CD85A806.web127_tyxl'
    data = urllib.parse.urlencode({})
    data = data.encode('utf-8')
    req = urllib.request.Request(url=url,method='POST')
    req.add_header('Referer', 'http://hdpx.webtrn.cn/learning/entity/first/peTchCoursewareItem_toMode.action?course_id='+id)
    req.add_header('Host', 'hdpx.webtrn.cn')
    req.add_header('User-Agent', 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:43.0) Gecko/20100101 Firefox/43.0')
    #req.add_header("Content-Type","application/x-www-form-urlencoded;charset=utf-8")
    req.add_header('X-Requested-With', 'XMLHttpRequest')
    req.add_header('Cookie', cookies)
    r = urllib.request.urlopen(req,data)
    print(r.read().decode('utf-8'))
input()
